import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TelDeviceStatsVO, TelDeviceStatsForm, TelDeviceStatsQuery } from '@/api/device/telDeviceStats/types';

/**
 * 查询设备时长统计列表
 * @param query
 * @returns {*}
 */

export const listTelDeviceStats = (query?: TelDeviceStatsQuery): AxiosPromise<TelDeviceStatsVO[]> => {
  return request({
    url: '/device/telDeviceStats/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询设备时长统计详细
 * @param id
 */
export const getTelDeviceStats = (id: string | number): AxiosPromise<TelDeviceStatsVO> => {
  return request({
    url: '/device/telDeviceStats/' + id,
    method: 'get'
  });
};

/**
 * 新增设备时长统计
 * @param data
 */
export const addTelDeviceStats = (data: TelDeviceStatsForm) => {
  return request({
    url: '/device/telDeviceStats',
    method: 'post',
    data: data
  });
};

/**
 * 修改设备时长统计
 * @param data
 */
export const updateTelDeviceStats = (data: TelDeviceStatsForm) => {
  return request({
    url: '/device/telDeviceStats',
    method: 'put',
    data: data
  });
};

/**
 * 删除设备时长统计
 * @param id
 */
export const delTelDeviceStats = (id: string | number | Array<string | number>) => {
  return request({
    url: '/device/telDeviceStats/' + id,
    method: 'delete'
  });
};
